//反正会炸，本地能过就行
//懒得取模了
#include <iostream>
#include <cstdio>

using namespace std;

int n, k;
int ans = 0;

void dfs(int tmp){
    while(tmp <= n){
        if(tmp == n){
            ans++;
            return;
        }
        for(int i = 1; i <= k; i++){
            dfs(tmp + i);
        }
    }
    return;
}

int main(){
    cin >> n >> k;
    dfs(1);
    cout << ans;
    return 0;
}